<html>
<!-- Mirrored from infohost.nmt.edu/tcc/help/pubs/tkinter/web/key-names.html by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 06 Nov 2017 11:41:57 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=UTF-8" /><!-- /Added by HTTrack -->
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>54.5. Key names</title><link rel="stylesheet" href="css/docbook.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.70.1"><link rel="start" href="index.html" title="Tkinter 8.5 reference: a GUI for Python"><link rel="up" href="events.html" title="54. Events: responding to stimuli"><link rel="prev" href="event-modifiers.html" title="54.4. Event modifiers"><link rel="next" href="event-handlers.html" title="54.6. Writing your handler: The Event
      class"></head><body><div class="topnavbar"><a href="event-handlers.html">Next</a> / <a href="event-modifiers.html">Previous</a> / <a href="index.html">Contents</a></div><div class="navheader"><table width="100%" summary="Navigation header"><tr valign="top"><td align="left" valign="top"><h1><span class="application">Tkinter</span> 8.5 reference: a GUI for Python</h1></td><td><img alt="organizational logo" src="img/logo.png"></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="key-names"></a>54.5. Key names</h3></div></div></div><p>
        The detail part of an event pattern for a <code class="code">KeyPress</code> or <code class="code">KeyRelease</code> event
        specifies which key you're binding.  (See the <code class="code">Any</code> modifier, above, if you want to get all
        keypresses or key releases).
      </p><p>
        The table below shows several different ways to name
        keys. See <a href="event-handlers.html" title="54.6. Writing your handler: The Event
      class">Section 54.6, “Writing your handler: The <code class="code">Event</code>
      class”</a>, below, for
        more information on <code class="code">Event</code> objects, whose
        attributes will describe keys in these same ways.
      </p><div class="itemizedlist"><ul type="disc"><li><p>
            The <code class="code">.keysym</code> column shows the
            “key symbol”, a string name for the
            key.  This corresponds to the <code class="code">.keysym</code>
            attribute of the <code class="code">Event</code> object.
          </p></li><li><p>
            The <code class="code">.keycode</code> column is the “key
            code.” This identifies which key was pressed,
            but the code does not reflect the state of various
            modifiers like the shift and control keys and the
            <span class="keysym">NumLock</span> key.  So, for example, both
            <code class="code">a</code> and <code class="code">A</code> have the same
            key code.
          </p></li><li><p>
            The <code class="code">.keysym_num</code> column shows a numeric
            code equivalent to the key symbol.  Unlike <code class="code">.keycode</code>, these codes are different for
            different modifiers.  For example, the digit 2 on the
            numeric keypad (key symbol <code class="code">KP_2</code>) and
            the down arrow on the numeric keypad (key symbol
            <code class="code">KP_Down</code>) have the same key code (88),
            but different <code class="code">.keysym_num</code> values
            (65433 and 65458, respectively).
          </p></li><li><p>
            The “Key” column shows the text you
            will usually find on the physical key, such as
            <span class="keysym">tab</span>.
          </p></li></ul></div><p>
        There are many more key names for international character
        sets.  This table shows only the “Latin-1”
        set for the usual USA-type 101-key keyboard.  For the
        currently supported set, see the <a href="http://www.tcl.tk/man/tcl8.4/TkCmd/keysyms.htm" target="_top">manual page for Tk <code class="code">keysym</code> values</a>.
      </p><div class="informaltable"><table border="1"><colgroup><col align="left"><col align="left"><col align="left"><col align="left"></colgroup><thead><tr><th align="left"><code class="code">.keysym</code></th><th align="left"><code class="code">.keycode</code></th><th align="left"><code class="code">.keysym_num</code></th><th align="left">Key</th></tr></thead><tbody><tr><td align="left"><code class="code">Alt_L</code></td><td align="left"><code class="code">64</code></td><td align="left"><code class="code">65513</code></td><td align="left">The left-hand <span class="keysym">alt</span> key</td></tr><tr><td align="left"><code class="code">Alt_R</code></td><td align="left"><code class="code">113</code></td><td align="left"><code class="code">65514</code></td><td align="left">The right-hand <span class="keysym">alt</span> key</td></tr><tr><td align="left"><code class="code">BackSpace</code></td><td align="left"><code class="code">22</code></td><td align="left"><code class="code">65288</code></td><td align="left"><span class="keysym">backspace</span></td></tr><tr><td align="left"><code class="code">Cancel</code></td><td align="left"><code class="code">110</code></td><td align="left"><code class="code">65387</code></td><td align="left"><span class="keysym">break</span></td></tr><tr><td align="left"><code class="code">Caps_Lock</code></td><td align="left"><code class="code">66</code></td><td align="left"><code class="code">65549</code></td><td align="left"><span class="keysym">CapsLock</span></td></tr><tr><td align="left"><code class="code">Control_L</code></td><td align="left"><code class="code">37</code></td><td align="left"><code class="code">65507</code></td><td align="left">The left-hand <span class="keysym">control</span> key</td></tr><tr><td align="left"><code class="code">Control_R</code></td><td align="left"><code class="code">109</code></td><td align="left"><code class="code">65508</code></td><td align="left">The right-hand <span class="keysym">control</span> key</td></tr><tr><td align="left"><code class="code">Delete</code></td><td align="left"><code class="code">107</code></td><td align="left"><code class="code">65535</code></td><td align="left"><span class="keysym">Delete</span></td></tr><tr><td align="left"><code class="code">Down</code></td><td align="left"><code class="code">104</code></td><td align="left"><code class="code">65364</code></td><td align="left">↓</td></tr><tr><td align="left"><code class="code">End</code></td><td align="left"><code class="code">103</code></td><td align="left"><code class="code">65367</code></td><td align="left"><span class="keysym">end</span></td></tr><tr><td align="left"><code class="code">Escape</code></td><td align="left"><code class="code">9</code></td><td align="left"><code class="code">65307</code></td><td align="left"><span class="keysym">esc</span></td></tr><tr><td align="left"><code class="code">Execute</code></td><td align="left"><code class="code">111</code></td><td align="left"><code class="code">65378</code></td><td align="left"><span class="keysym">SysReq</span></td></tr><tr><td align="left"><code class="code">F1</code></td><td align="left"><code class="code">67</code></td><td align="left"><code class="code">65470</code></td><td align="left">Function key <span class="keysym">F1</span></td></tr><tr><td align="left"><code class="code">F2</code></td><td align="left"><code class="code">68</code></td><td align="left"><code class="code">65471</code></td><td align="left">Function key <span class="keysym">F2</span></td></tr><tr><td align="left"><code class="code">F<sub>i</sub></code></td><td align="left"><code class="code">66+i</code></td><td align="left"><code class="code">65469+i</code></td><td align="left">Function key <span class="keysym">F</span><sub>i</sub></td></tr><tr><td align="left"><code class="code">F12</code></td><td align="left"><code class="code">96</code></td><td align="left"><code class="code">65481</code></td><td align="left">Function key <span class="keysym">F12</span></td></tr><tr><td align="left"><code class="code">Home</code></td><td align="left"><code class="code">97</code></td><td align="left"><code class="code">65360</code></td><td align="left"><span class="keysym">home</span></td></tr><tr><td align="left"><code class="code">Insert</code></td><td align="left"><code class="code">106</code></td><td align="left"><code class="code">65379</code></td><td align="left"><span class="keysym">insert</span></td></tr><tr><td align="left"><code class="code">Left</code></td><td align="left"><code class="code">100</code></td><td align="left"><code class="code">65361</code></td><td align="left">←</td></tr><tr><td align="left"><code class="code">Linefeed</code></td><td align="left"><code class="code">54</code></td><td align="left"><code class="code">106</code></td><td align="left">Linefeed (<span class="keysym">control-J</span>)</td></tr><tr><td align="left"><code class="code">KP_0</code></td><td align="left"><code class="code">90</code></td><td align="left"><code class="code">65438</code></td><td align="left">0 on the keypad</td></tr><tr><td align="left"><code class="code">KP_1</code></td><td align="left"><code class="code">87</code></td><td align="left"><code class="code">65436</code></td><td align="left">1 on the keypad</td></tr><tr><td align="left"><code class="code">KP_2</code></td><td align="left"><code class="code">88</code></td><td align="left"><code class="code">65433</code></td><td align="left">2 on the keypad</td></tr><tr><td align="left"><code class="code">KP_3</code></td><td align="left"><code class="code">89</code></td><td align="left"><code class="code">65435</code></td><td align="left">3 on the keypad</td></tr><tr><td align="left"><code class="code">KP_4</code></td><td align="left"><code class="code">83</code></td><td align="left"><code class="code">65430</code></td><td align="left">4 on the keypad</td></tr><tr><td align="left"><code class="code">KP_5</code></td><td align="left"><code class="code">84</code></td><td align="left"><code class="code">65437</code></td><td align="left">5 on the keypad</td></tr><tr><td align="left"><code class="code">KP_6</code></td><td align="left"><code class="code">85</code></td><td align="left"><code class="code">65432</code></td><td align="left">6 on the keypad</td></tr><tr><td align="left"><code class="code">KP_7</code></td><td align="left"><code class="code">79</code></td><td align="left"><code class="code">65429</code></td><td align="left">7 on the keypad</td></tr><tr><td align="left"><code class="code">KP_8</code></td><td align="left"><code class="code">80</code></td><td align="left"><code class="code">65431</code></td><td align="left">8 on the keypad</td></tr><tr><td align="left"><code class="code">KP_9</code></td><td align="left"><code class="code">81</code></td><td align="left"><code class="code">65434</code></td><td align="left">9 on the keypad</td></tr><tr><td align="left"><code class="code">KP_Add</code></td><td align="left"><code class="code">86</code></td><td align="left"><code class="code">65451</code></td><td align="left">+ on the keypad</td></tr><tr><td align="left"><code class="code">KP_Begin</code></td><td align="left"><code class="code">84</code></td><td align="left"><code class="code">65437</code></td><td align="left">The center key (same key as 5) on the keypad</td></tr><tr><td align="left"><code class="code">KP_Decimal</code></td><td align="left"><code class="code">91</code></td><td align="left"><code class="code">65439</code></td><td align="left">Decimal (<code class="code">.</code>) on the keypad</td></tr><tr><td align="left"><code class="code">KP_Delete</code></td><td align="left"><code class="code">91</code></td><td align="left"><code class="code">65439</code></td><td align="left"><span class="keysym">delete</span> on the keypad</td></tr><tr><td align="left"><code class="code">KP_Divide</code></td><td align="left"><code class="code">112</code></td><td align="left"><code class="code">65455</code></td><td align="left"><code class="code">/</code> on the keypad</td></tr><tr><td align="left"><code class="code">KP_Down</code></td><td align="left"><code class="code">88</code></td><td align="left"><code class="code">65433</code></td><td align="left">↓ on the keypad</td></tr><tr><td align="left"><code class="code">KP_End</code></td><td align="left"><code class="code">87</code></td><td align="left"><code class="code">65436</code></td><td align="left"><span class="keysym">end</span> on the keypad</td></tr><tr><td align="left"><code class="code">KP_Enter</code></td><td align="left"><code class="code">108</code></td><td align="left"><code class="code">65421</code></td><td align="left"><span class="keysym">enter</span> on the keypad</td></tr><tr><td align="left"><code class="code">KP_Home</code></td><td align="left"><code class="code">79</code></td><td align="left"><code class="code">65429</code></td><td align="left"><span class="keysym">home</span> on the keypad</td></tr><tr><td align="left"><code class="code">KP_Insert</code></td><td align="left"><code class="code">90</code></td><td align="left"><code class="code">65438</code></td><td align="left"><span class="keysym">insert</span> on the keypad</td></tr><tr><td align="left"><code class="code">KP_Left</code></td><td align="left"><code class="code">83</code></td><td align="left"><code class="code">65430</code></td><td align="left">← on the keypad</td></tr><tr><td align="left"><code class="code">KP_Multiply</code></td><td align="left"><code class="code">63</code></td><td align="left"><code class="code">65450</code></td><td align="left">× on the keypad</td></tr><tr><td align="left"><code class="code">KP_Next</code></td><td align="left"><code class="code">89</code></td><td align="left"><code class="code">65435</code></td><td align="left"><span class="keysym">PageDown</span> on the keypad</td></tr><tr><td align="left"><code class="code">KP_Prior</code></td><td align="left"><code class="code">81</code></td><td align="left"><code class="code">65434</code></td><td align="left"><span class="keysym">PageUp</span> on the keypad</td></tr><tr><td align="left"><code class="code">KP_Right</code></td><td align="left"><code class="code">85</code></td><td align="left"><code class="code">65432</code></td><td align="left">→ on the keypad</td></tr><tr><td align="left"><code class="code">KP_Subtract</code></td><td align="left"><code class="code">82</code></td><td align="left"><code class="code">65453</code></td><td align="left"><code class="code">-</code> on the
                keypad</td></tr><tr><td align="left"><code class="code">KP_Up</code></td><td align="left"><code class="code">80</code></td><td align="left"><code class="code">65431</code></td><td align="left">↑ on the keypad</td></tr><tr><td align="left"><code class="code">Next</code></td><td align="left"><code class="code">105</code></td><td align="left"><code class="code">65366</code></td><td align="left"><span class="keysym">PageDown</span></td></tr><tr><td align="left"><code class="code">Num_Lock</code></td><td align="left"><code class="code">77</code></td><td align="left"><code class="code">65407</code></td><td align="left"><span class="keysym">NumLock</span></td></tr><tr><td align="left"><code class="code">Pause</code></td><td align="left"><code class="code">110</code></td><td align="left"><code class="code">65299</code></td><td align="left"><span class="keysym">pause</span></td></tr><tr><td align="left"><code class="code">Print</code></td><td align="left"><code class="code">111</code></td><td align="left"><code class="code">65377</code></td><td align="left"><span class="keysym">PrintScrn</span></td></tr><tr><td align="left"><code class="code">Prior</code></td><td align="left"><code class="code">99</code></td><td align="left"><code class="code">65365</code></td><td align="left"><span class="keysym">PageUp</span></td></tr><tr><td align="left"><code class="code">Return</code></td><td align="left"><code class="code">36</code></td><td align="left"><code class="code">65293</code></td><td align="left">The <span class="keysym">enter</span> key
                (<span class="keysym">control-M</span>).  The name
                <code class="code">Enter</code> refers to a
                mouse-related event, not a keypress; see <a href="events.html" title="54. Events: responding to stimuli">Section 54, “Events”</a></td></tr><tr><td align="left"><code class="code">Right</code></td><td align="left"><code class="code">102</code></td><td align="left"><code class="code">65363</code></td><td align="left">→</td></tr><tr><td align="left"><code class="code">Scroll_Lock</code></td><td align="left"><code class="code">78</code></td><td align="left"><code class="code">65300</code></td><td align="left"><span class="keysym">ScrollLock</span></td></tr><tr><td align="left"><code class="code">Shift_L</code></td><td align="left"><code class="code">50</code></td><td align="left"><code class="code">65505</code></td><td align="left">The left-hand <span class="keysym">shift</span> key</td></tr><tr><td align="left"><code class="code">Shift_R</code></td><td align="left"><code class="code">62</code></td><td align="left"><code class="code">65506</code></td><td align="left">The right-hand <span class="keysym">shift</span> key</td></tr><tr><td align="left"><code class="code">Tab</code></td><td align="left"><code class="code">23</code></td><td align="left"><code class="code">65289</code></td><td align="left">The <span class="keysym">tab</span> key</td></tr><tr><td align="left"><code class="code">Up</code></td><td align="left"><code class="code">98</code></td><td align="left"><code class="code">65362</code></td><td align="left">↑</td></tr></tbody></table></div></div><hr><div class="navfooter"><div class="botlinks"><div class="bot-next"><b>Next: </b><a href="event-handlers.html">54.6. Writing your handler: The <code class="code">Event</code>
      class</a></div><div class="bot-contents"><b>Contents: </b><a href="index.html"><span class="application">Tkinter</span> 8.5 reference: a GUI for Python</a></div><div class="bot-prev"><b>Previous: </b><a href="event-modifiers.html">54.4. Event modifiers</a></div><div><b>Home: </b><a href="http://www.nmt.edu/">About New Mexico Tech</a></div></div><hr><div class="colophon"><address><div class="colophon-author">John W. Shipman</div><div class="colophon-mailto">Comments welcome: <a href="mailto:tcc-doc@nmt.edu">tcc-doc@nmt.edu</a></div></address><div class="colophon-date">Last updated: 2013-12-31 17:59</div><div class="colophon-url">URL: <span class="colophon-uri">http://www.nmt.edu/tcc/help/pubs/tkinter/web/key-names.html</span></div></div></div></body>
<!-- Mirrored from infohost.nmt.edu/tcc/help/pubs/tkinter/web/key-names.html by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 06 Nov 2017 11:41:57 GMT -->
</html>
